home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Hot Mix 17
/
Hot Mix 17.iso
/
HM17_SGI
/
research
/
examples
/
demo
/
demosrc
/
d_widgets.pro
< prev
next >
Wrap
Text File
|
1997-07-08
|
51KB
|
1,460 lines
;$Id: d_widgets.pro,v 1.15 1997/04/24 18:09:46 tremblay Exp $
;
; Copyright (c) 1997, Research Systems, Inc. All rights reserved.
; Unauthorized reproduction prohibited.
;
;+
; FILE:
; widgets.pro
;
; CALLING SEQUENCE: widgets
;
; PURPOSE:
; shows every widgets available in IDL 5.0
;
; MAJOR TOPICS: widgets
;
; CATEGORY:
; IDL 5.0
;
; INTERNAL FUNCTIONS and PROCEDURES:
; pro widgets_Event - Event handler
; pro widgets_Cleanup - Cleanup
; pro widgets - Main procedure
;
; EXTERNAL FUNCTIONS, PROCEDURES, and FILES:
; fun cwtable - Compound widget
; widgets.txt
; base.gif
; button.gif
; draw.gif
; droplist.gif
; label.gif
; list.gif
; slider.gif
; table.gif
; text.gif
;
; REFERENCE: IDL Reference Guide, IDL User's Guide
;
; NAMED STRUCTURES:
; none.
;
; COMMON BLOCS:
; none.
;
; MODIFICATION HISTORY:
; 96, DAT - Written
;
;-
; -----------------------------------------------------------------------------
;
; Purpose: Function returns the 3 angles of a space three 1-2-3
; given a 3 x 3 cosine direction matrix
; else -1 on failure.
;
; Definition : Given 2 sets of dextral orthogonal unit vectors
; (a1, a2, a3) and (b1, b2, b3), the cosine direction matrix
; C (3 x 3) is defined as the dot product of:
;
; C(i,j) = ai . bi where i = 1,2,3
;
; A column vector X (3 x 1) becomes X' (3 x 1)
; after the rotation as defined as :
;
; X' = C X
;
; The space three 1-2-3 means that the x rotation is first,
; followed by the y rotation, then the z.
;
function angle3123, $
cosMat ; IN: cosine direction matrix (3 x 3)
; Verify the input parameters
;
if (N_PARAMS() ne 1) then begin
PRINT,'Error in angle3123: 1 parameters must be passed.'
RETURN, -1
endif
sizec = size(cosMat)
if (sizec(0) ne 2) then begin
PRINT,'Error, the input matrix must be of dimension 2'
RETURN, -1
endif
if ((sizec(1) ne 3) or (sizec(2) ne 3)) then begin
PRINT,'Error, the input matrix must be 3 by 3'
RETURN, -1
endif
; Compute the 3 angles (in degrees)
;
cosMat = TRANSPOSE(cosMat)
angle = FLTARR(3)
angle(1) = -cosMat(2,0)
angle(1) = ASIN(angle(1))
c2 = COS(angle(1))
if (ABS(angle(1)) lt 1.0e-6) then begin
angle(0) = ATAN(-cosMat(1,2), cosMat(1,1))
angle(2) = 0.0
endif else begin
angle(0) = ATAN( cosMat(2,1), cosMat(2,2))
angle(2) = ATAN( cosMat(1,0), cosMat(0,0))
endelse
angle = angle * (180.0/!DPI)
RETURN, angle
end ; of angle3123
;$Id: d_widgets.pro,v 1.15 1997/04/24 18:09:46 tremblay Exp $
;
; Copyright (c) 1997, Research Systems, Inc. All rights reserved.
; Unauthorized reproduction prohibited.
;
;+
; FILE:
; cwtable.pro
;
; PURPOSE:
; This compound widget shows the IDL 5.0 available
; widgets.
;
; CATEGORY:
; IDL 5.0
;
; CONTENTS:
; function space3123 - compute the cosine direction matrix
; of a space-three-123
; pro GetDrawID - get the window ID on realization
; pro Mytable_Event - event handler
; pro cwtable - main procedure
;
; FUNCTION/PROCEDURE CALLED
; function angle3123 - compute the the angles
; of a space-three-123
;
; NAMED STRUCTURES:
; none.
;
; COMMON BLOCS:
; none.
;
; MODIFICATION HISTORY:
; 10/96, DAT - Written.
;-
; -----------------------------------------------------------------------------
;
; Purpose: Function returns the cosine direction matrix (3 x 3)
; given the space three 1-2-3 rotation angles(i.e. rotation around
; x axis, followed by Y axis, then z axis),
; else -1 on failure.
;
; Definition : Given 2 sets of dextral orthogonal unit vectors
; (a1, a2, a3) and (b1, b2, b3), the cosine direction matrix
; C (3 x 3) is defined as the dot product of:
;
; C(i,j) = ai . bi where i = 1,2,3
;
; A column vector X (3 x 1) becomes X' (3 x 1)
; after the rotation as defined as :
;
; X' = C X
;
function space3123, $
theta, $ ; IN: angle of rotation around the x axis(in degrees)
phi, $ ; IN: angle of rotation around the y axis(in degrees)
gamma ; IN: angle of rotation around the z axis(in degrees)
; Verify the input parameters.
;
if (N_PARAMS() ne 3) then begin
PRINT,'Error in space3123: 3 parameters must be passed.'
RETURN, -1
endif
cosMat = FLTARR(3, 3)
; Transform the angle in radians.
;
rTheta = theta * !DPI / 180.0
rPhi = Phi * !DPI / 180.0
rGamma = Gamma * !DPI / 180.0
cos1 = COS(rTheta)
cos2 = COS(rPhi)
cos3 = COS(rGamma)
sin1 = SIN(rTheta)
sin2 = SIN(rPhi)
sin3 = SIN(rGamma)
; Compute the cosine direction matrix.
;
cosMat(0,0) = cos2*cos3
cosMat(1,0) = cos2*sin3
cosMat(2,0) = -sin2
cosMat(0,1) = (sin1*sin2*cos3) - (cos1*sin3)
cosMat(1,1) = (sin1*sin2*sin3) + (cos1*cos3)
cosMat(2,1) = sin1*cos2
cosMat(0,2) = (cos1*sin2*cos3) + (sin1*sin3)
cosMat(1,2) = (cos1*sin2*sin3) - (sin1*cos3)
cosMat(2,2) = cos1*cos2
RETURN, cosMat
end ; of space3123
; -----------------------------------------------------------------------------
;
; Purpose: On realization of the draw widget, get the window object ID,
; and place it into the user value of the draw base which
; is the widget draw parent.
;
pro GetDrawID, id
WIDGET_CONTROL, id, GET_VALUE = drawWindowObjID
wDrawBase = WIDGET_INFO(id, /PARENT)
WIDGET_CONTROL, wDrawBase, SET_UVALUE =drawWindowObjID , /NO_COPY
end
; -----------------------------------------------------------------------------
;
; Purpose: Handle the events of this compound widget.
;
pro MyTable_Event, $
sEvent ; IN: event structure
; Quit the application using the close box.
;
if (TAG_NAMES(sEvent, /STRUCTURE_NAME) EQ $
'WIDGET_KILL_REQUEST') then begin
WIDGET_CONTROL, sEvent.top, /DESTROY
RETURN
endif
; Get the info structure.
;
child = WIDGET_INFO(sEvent.handler, /CHILD)
WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
; Get the drawWindow object identifier
; which is the user value of the draw base.
;
WIDGET_CONTROL, sInfo.wDrawBase, $
GET_UVALUE=temp, /NO_COPY
oDrawWindowID = temp
WIDGET_CONTROL, sInfo.wDrawBase, $
SET_UVALUE=temp, /NO_COPY
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
; Branch the event accordingly to its name and its user value.
;
eventName = WIDGET_INFO(sEvent.id,/NAME)
case eventName of
'TABLE' : begin
; Insertion of character.
;
if (sEvent.type eq 0) then begin
; Take action only when the carriage return character
; is typed.
;
if (sEvent.ch EQ 13) then begin
WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
WIDGET_CONTROL, sInfo.wDataTable, GET_VALUE=data, $
USE_TABLE_SELECT=[0, 0, $
sInfo.xdimension-1, sInfo.ydimension-1]
highData = WHERE(data gt 9, countHigh)
if(countHigh ne 0) then begin
data(highData) = 9
endif
lowData = WHERE(data lt 0, countLow)
if(countLow ne 0) then begin
data(LowData) = 0
endif
if ((countHigh gt 0) or (countLow gt 0)) then begin
WIDGET_CONTROL, sInfo.wDataTable, SET_VALUE=data, $
USE_TABLE_SELECT=[0, 0, $
sInfo.xdimension-1, sInfo.ydimension-1]
endif
; Reset the vertex colors.
;
xtot = sInfo.xdimension * sInfo.ydimension
shades2 = FLTARR(xtot)
shades2(0:xtot-1) = data(0:sInfo.xdimension-1, $
0:sInfo.ydimension-1)
maxshades = sInfo.maxDataValue
minshades = sInfo.minDataValue
sat = 1.0
val = 1.0
maxangle = 225.0 ; ( angle is 0 < .. < 360 )
for j = 0, xtot-1 do begin
angle =ROUND( (shades2(j) - minshades) / $
(maxshades-minshades) * maxangle )
color_convert, angle, sat, $
val, red, green, blue, /hsv_rgb
sInfo.vertexColors(0, j) = red
sInfo.vertexColors(1, j) = green
sInfo.vertexColors(2, j) = blue
endfor
; Draw the surface.
;
if(sInfo.vertexFlag eq 1) then begin
sInfo.oSimpleSurface->SetProperty, $
VERT_COLORS=sInfo.vertexColors
endif
sInfo.oSimpleSurface->SetProperty, DATAZ=data
oDrawWindowID->Draw, sInfo.oView
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
endif
endif
end ; of TABLE
'BUTTON' : begin
WIDGET_CONTROL, sEvent.id, GET_UVALUE=uvalue
case uvalue of
'POPINFO' : begin
void = DIALOG_MESSAGE('This message window is modal.' + $
'Press OK to continue')
end ; of POPINFO
'INFO' : begin
if( Xregistered('XDisplayFile') ne 0) then RETURN
XDisplayFile, filepath("widgets.txt", $
SUBDIR=['examples','demo','demotext']), $
DONE_BUTTON='Done', $
TITLE="About widgets", $
GROUP=sEvent.top, WIDTH=55, HEIGHT=14
end ; of INFO
'QUIT' : begin
; Destroy the parent of cwtable, i.e
; destroy everything.
;
child = WIDGET_INFO(sEvent.handler, /CHILD)
WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
WIDGET_CONTROL, sInfo.parent, /DESTROY
end ; of QUIT
endcase ; of uvalue
end ; of BUTTON
'DROPLIST' : begin
listValue = WIDGET_INFO( sEvent.id, /DROPLIST_SELECT)
WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
case listValue of
; Wire style.
;
0 : begin
sInfo.oSimpleSurface->SetProperty, STYLE=1
oDrawWindowID->Draw, sInfo.oView
end ; of 0
; Solid style.
;
1 : begin
sInfo.oSimpleSurface->SetProperty, STYLE=2
oDrawWindowID->Draw, sInfo.oView
end ; of 1
; Lego solid style.
;
2 : begin
sInfo.oSimpleSurface->SetProperty, STYLE=6
oDrawWindowID->Draw, sInfo.oView
end ; of 2
endcase ; of listValue
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
end ; of DROPLIST
; Handle the CW_FIELD text event (a BASE event is returned here).
;
'BASE' : begin
WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
WIDGET_CONTROL, sInfo.wStatusLabel, SET_VALUE=sEvent.value
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
end ; of BASE
; Handle the list event, Choose between 4 color scenarios.
;
'LIST' : begin
WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
listValue = WIDGET_INFO( sEvent.id, /LIST_SELECT)
case listValue of
; White.
;
0 : begin
sInfo.oSimpleSurface->SetProperty, VERT_COLORS=0
sInfo.oSimpleSurface->SetProperty, COLOR=[255,255,255]
oDrawWindowID->Draw, sInfo.oView
sInfo.vertexFlag=0
end ; of 0
; Yellow.
;
1 : begin
sInfo.oSimpleSurface->SetProperty, VERT_COLORS=0
sInfo.oSimpleSurface->SetProperty, COLOR=[255,255,0]
oDrawWindowID->Draw, sInfo.oView
sInfo.vertexFlag=0
end ; of 1
; Red.
;
2 : begin
sInfo.oSimpleSurface->SetProperty, VERT_COLORS=0
sInfo.oSimpleSurface->SetProperty, COLOR=[255,0,0]
oDrawWindowID->Draw, sInfo.oView
sInfo.vertexFlag=0
end ; of 2
; Rainbow or Hue.
;
3 : begin
sInfo.oSimpleSurface->SetProperty, $
VERT_COLORS=sInfo.vertexColors
oDrawWindowID->Draw, sInfo.oView
sInfo.vertexFlag=1
end ; of 3
endcase
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
end ; of LIST
; Handle the rotation.
;
'SLIDER' : begin
WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
WIDGET_CONTROL, sInfo.wXSlider, GET_VALUE=xDegree
WIDGET_CONTROL, sInfo.wYSlider, GET_VALUE=yDegree
WIDGET_CONTROL, sInfo.wZSlider, GET_VALUE=zDegree
matFinal = FLTARR(3,3)
matFinal = space3123(xDegree, yDegree, zDegree)
sInfo.oRotationModel->GetProperty, TRANSFORM=t
tempMat = FLTARR(3,3)
tempMat(0:2, 0:2) = TRANSPOSE(t(0:2, 0:2))
tempMat = TRANSPOSE(tempMat)
rotMat = matFinal # tempMat
; Find the Euler parameters 'e4' of rotMat
; which is the rotation it takes to go from
; the original (t) to the final (matFinal).
;
e4 = 0.5 * SQRT(1.0 + rotMat(0,0) + $
rotMat(1,1) + rotMat(2,2))
; Find the unit vector of the single rotation axis
; and the angle of rotation.
;
if (e4 eq 0) then begin
if (rotMat(0,0) eq 1) then begin
axisRot = [1, 0, 0]
endif else if(rotMat(1,1) eq 1) then begin
axisRot = [0, 1, 0]
endif else begin
axisRot = [0, 0, 1]
endelse
angleRot = 180.0
endif else begin
e1 = (rotMat(2,1) - rotMat(1,2))/(4.0*e4)
e2 = (rotMat(0,2) - rotMat(2,0))/(4.0*e4)
e3 = (rotMat(1,0) - rotMat(0,1))/(4.0*e4)
modulusE = SQRT(e1*e1 + e2*e2 +e3*e3)
if(modulusE eq 0.0) then begin
WIDGET_CONTROL, child, $
SET_UVALUE=sInfo, /NO_COPY
RETURN
endif
axisRot = FLTARR(3)
axisRot(0) = e1/modulusE
axisRot(1) = e2/modulusE
axisRot(2) = e3/modulusE
angleRot = (2.0 * ACOS(e4)) * 180 / !DPI
endelse
for i = 0, 2 do begin
if(ABS(axisRot(i)) lt 1.0e-6) then axisRot(i)=1.0e-6
endfor
sInfo.oRotationModel->Rotate, axisRot, angleRot
oDrawWindowID->Draw, sInfo.oView
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
end ; of SLIDER
'DRAW': begin
WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
; Expose.
;
if (sEvent.type eq 4) then begin
oDrawWindowID->Draw, sInfo.oView
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
RETURN
endif
; Handle trackball update
;
bHaveTransform = sInfo.oTrack->Update(sEvent, TRANSFORM=qmat )
if (bHaveTransform NE 0) then begin
sInfo.oRotationModel->GetProperty, TRANSFORM=t
mt = t # qmat
sInfo.oRotationModel->SetProperty,TRANSFORM=mt
endif
; Button press.
;
if (sEvent.type eq 0) then begin
sInfo.btndown = 1B
oDrawWindowID->SetProperty, QUALITY=2
WIDGET_CONTROL, sInfo.wAreaDraw, /DRAW_MOTION
endif ; of Button press
; Button motion.
;
if ((sEvent.type eq 2) and (sInfo.btndown eq 1B)) then begin
if (bHaveTransform) then begin
; Reset the x, y, z axis angle values.
;
sInfo.oRotationModel->GetProperty, TRANSFORM=transform
tempMat = FLTARR(3,3)
xyzAngles = FLTARR(3)
tempMat(0:2, 0:2) = transform(0:2, 0:2)
xyzAngles = Angle3123(tempMat)
WIDGET_CONTROL, sInfo.wXSlider, SET_VALUE=xyzAngles(0)
WIDGET_CONTROL, sInfo.wYSlider, SET_VALUE=xyzAngles(1)
WIDGET_CONTROL, sInfo.wZSlider, SET_VALUE=xyzAngles(2)
oDrawWindowID->Draw, sInfo.oView
endif
endif ; of Button motion
; Button release.
;
if (sEvent.type eq 1) then begin
if (sInfo.btndown EQ 1b) then begin
oDrawWindowID->SetProperty, QUALITY=2
oDrawWindowID->Draw, sInfo.oView
endif
sInfo.btndown = 0B
WIDGET_CONTROL, sInfo.wAreaDraw, DRAW_MOTION=0
endif
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
end ; of DRAW
else : begin
print, 'This event is not handled.'
end ; of else
endcase
end ; of event handler
;----------------------------------------------------------------------------
;
; Purpose: This application shows the thuse of every widgets
; available in IDL 5.0. Namely : base, button, slider,
; droplist, list, label, draw, table, text, and messasge.
;
; This application is a compound widget and must be called by
; a driver (main) application. It returns the top level base
; (sCWBase) of the compound widget.
;
; Additional information: in the driver code (main), in order to get
; the info structure and the draw window object ID, type this:
;
; child = WIDGET_INFO(wCWBase, /CHILD)
; WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
; WIDGET_CONTROL,sInfo.wDrawBase, GET_UVALUE=oDrawWindowID, /NO_COPY
;
function cwtable, $
parent, $ ; IN: parent base
XOFFSET=xOffset, $ ; IN: (opt) x offset (in pixel)
YOFFSET=yOffset, $ ; IN: (opt) x offset (in pixel)
MAPFLAG=mapFlag ; IN: (opt) 0= not showing, 1= showing
if (N_PARAMS() ne 1) then begin
PRINT,'Error: 1 parameter must be passed'
RETURN, -1L
endif
; Set the dimension of the draw widget.
;
Device, GET_SCREEN_SIZE = screenDim
xdim = screenDim(0)*0.3
ydim = screenDim(1)*0.3
; Create a surface.
;
data = dist(10)
xArray = INDGEN(10)
yArray = INDGEN(10)
; Set up the default parameters.
;
if (N_ELEMENTS(mapFlag) eq 0) then begin
mapFlag = 1
endif
if ((mapFlag NE 0) and (mapFlag NE 1)) then begin
mapFlag = 1
endif
if (N_ELEMENTS(xOffset) EQ 0) then begin
xOffset = 0
endif
if (N_ELEMENTS(yOffset) EQ 0) then begin
yOffset = 0
endif
; Get the tips.
;
sText = getTips(filepath('widgets.tip', $
SUBDIR=['examples','demo', 'demotext']) )
; Create the top level base.
;
wCWBase = WIDGET_BASE( /COLUMN, YPAD=0, XPAD=0, $
MBAR=barBase, TLB_FRAME_ATTR=1, TITLE='Widgets', $
MAP=mapFlag, SPACE=15, GROUP_LEADER=parent, $
/TLB_KILL_REQUEST_EVENTS, $
XOFFSET=xOffset, YOFFSET=yOffset)
; Create the file menu bar item that contains the quit button.
;
wFileButton = WIDGET_BUTTON(barBase, VALUE='File', /MENU)
wQuitButton = WIDGET_BUTTON(wFileButton, $
VALUE='Quit', UVALUE='QUIT')
; Create the menu bar item help that contains the about button.
;
wHelpButton = WIDGET_BUTTON(barBase, VALUE='About', /HELP, /MENU)
wAboutButton = WIDGET_BUTTON(wHelpButton, $
VALUE='About Widgets', UVALUE='INFO')
; Create the first child of the graghic base.
;
wSubBase = WIDGET_BASE(wCWBase, COLUMN=2)
; Create a base for the left column.
;
wLeftBase = WIDGET_BASE(wSubBase, /BASE_ALIGN_CENTER, $
/COLUMN)
wStyleBase = WIDGET_BASE(wLeftBase, /COLUMN, $
/FRAME, MAP=mapFlag)
wStyleDroplist = WIDGET_DROPLIST(wStyleBase, $
VALUE=['Wire', 'Solid', 'Lego Solid'], $
UVALUE='STYLELIST', TITLE='Style')
wSliderBase = WIDGET_BASE(wLeftBase, /COLUMN, $
/FRAME, YPAD=8, XPAD=8, MAP=mapFlag)
wSliderLabel = WIDGET_LABEL(wSliderBase, $
VALUE='Rotation', /ALIGN_CENTER)
wXSlider = WIDGET_SLIDER(wSliderBase, $
VALUE=-45, MINIMUM=-180, MAXIMUM=180, $
UVALUE='XROTATION')
wSliderXLabel = WIDGET_LABEL(wSliderBase, $
VALUE='X Axis')
wYSlider = WIDGET_SLIDER(wSliderBase, $
VALUE=45, MINIMUM=-180, MAXIMUM=180, $
UVALUE='YROTATION')
wSliderYLabel = WIDGET_LABEL(wSliderBase, $
VALUE='Y Axis')
wZSlider = WIDGET_SLIDER(wSliderBase, $
VALUE=0, MINIMUM=-180, MAXIMUM=180, $
UVALUE='ZROTATION')
wSliderZLabel = WIDGET_LABEL(wSliderBase, $
VALUE='Z Axis')
wPopInfoBase = WIDGET_BASE(wLeftBase, /COLUMN, $
/FRAME, YPAD=8, XPAD=8, MAP=mapFlag)
wPopInfoButton = WIDGET_BUTTON(wPopInfoBase, $
VALUE='Message', UVALUE='POPINFO')
; Create the status label.
;
wStatusBase = WIDGET_BASE(wLeftBase, /COLUMN, /FRAME, $
YPAD=0, XPAD=0, MAP=mapFlag)
wStatusLabel = WIDGET_LABEL(wStatusBase, /ALIGN_LEFT, $
VALUE='Widgets are active.')
; Create a base for the left column.
;
wRightBase = WIDGET_BASE(wSubBase, /COLUMN)
wTopRightBase = WIDGET_BASE(wRightBase, /ROW)
wColorBase = WIDGET_BASE(wTopRightBase, /COLUMN, $
/FRAME, MAP=mapFlag)
wColorLabel = WIDGET_LABEL(wColorBase, $
VALUE='Surface color')
wColorList = WIDGET_LIST(wColorBase, VALUE=['White', $
'Yellow', 'Red', 'Hue'], YSIZE=2, UVALUE='COLORLIST')
wTextBase = WIDGET_BASE(wTopRightBase, /COLUMN, $
/FRAME, YPAD=8, XPAD=8, MAP=mapFlag)
cwTextField = CW_FIELD(wTextBase, $
/RETURN_EVENTS, /COLUMN, /STRING, $
TITLE='Status label', VALUE='Widgets are active.', $
UVALUE='TITLEFIELD')
wTableBase = WIDGET_BASE(wRightBase, /COLUMN, $
YPAD=0, XPAD=0, MAP=mapFlag)
sizeX = SIZE(xArray)
sizeY = SIZE(yArray)
wDataTable = WIDGET_TABLE(wTableBase, $
VALUE=data, /EDITABLE, /ALL_EVENTS, $
XSIZE=sizeX(1), YSIZE=sizeY(1), $
X_SCROLL_SIZE=2, Y_SCROLL_SIZE=2 )
wDrawBase = WIDGET_BASE(wRightBase, /COLUMN, $
/FRAME, YPAD=8, XPAD=8, MAP=mapFlag, UVALUE=-1)
wAreaDraw = WIDGET_DRAW(wDrawBase, $
XSIZE=xdim, YSIZE=ydim, /BUTTON_EVENTS, $
/EXPOSE_EVENTS, UVALUE='DRAW', $
GRAPHICS_LEVEL=2, $
NOTIFY_REALIZE='GetDrawID')
; Create the status line label.
;
wTipBase = WIDGET_BASE(wCWBase, MAP=0, /ROW)
nWidgets = 2
wText = LONARR(nWidgets)
widTips, wTipBase, sText.text, XSIZE=36, $
YSIZE=3, NWIDGETS=nWidgets, wText
; Realize the widget hierarchy
;
WIDGET_CONTROL, wCWBase, /REALIZE
; Size the tips widgets. Unmap the tips.
;
sizeTips, wCWBase, wText, wTipBase
WIDGET_CONTROL, wTipBase, MAP=0
; Set the default list and droplist items.
;
WIDGET_CONTROL, wStyleDroplist, SET_DROPLIST_SELECT=1
WIDGET_CONTROL, wColorlist, SET_LIST_SELECT=3
; Set the view such that the surface is
; contained within a box defined by
; by radx and rady ( view normal coordinates).
;
sqr3 = SQRT(3)/1.5 ; length of a diagonal in a cube
radx = SQRT(2.0) ; viewport in normal coordinates
rady = SQRT(2.0)
; Select the normal corrdinates of the
; orthogonal axes location within the volume.
; example:
; middle : axesX, axesY, axesZ = -0.5
; lowest data values : axesX, axesY, axesZ = 0.0
; highest data values : axesX, axesY, axesZ = -1.0
;
axesX = -0.5
axesY = -0.5
axesZ = -0.5
xMargin = (1.0-sqr3)/2.0
yMargin = (1.0-sqr3)/2.0
xv = ((xMargin)*radx + axesX)
yv = ((yMargin)*rady + axesY)
width = 1.0 - 2.0 * xMargin* radx
height = 1.0 - 2.0 * yMargin * radY
myview = [xv, yv, width, height]
; Create view.
;
oView = OBJ_NEW('idlgrview', PROJECTION=2, EYE=3, $
ZCLIP=[1.5, -1.5], VIEWPLANE_RECT=myview, COLOR=[0,0,0])
; Create model.
;
oStaticModel = OBJ_NEW('idlgrmodel')
oMovableModel = OBJ_NEW('idlgrmodel')
oRotationModel = OBJ_NEW('idlgrmodel')
oScalingModel = OBJ_NEW('idlgrmodel')
oTranslationModel = OBJ_NEW('idlgrmodel')
oStaticModel->Add, oMovableModel
oMovableModel->Add, oRotationModel
oRotationModel->Add, oScalingModel
oScalingModel->Add, oTranslationModel
sc = 0.7
oStaticModel->Scale, sc, sc, sc
; Create light.
;
oLight1 = OBJ_NEW('idlgrLight', TYPE=1, INTENSITY=0.8, $
LOCATION=[2,2,2])
oLight2 = OBJ_NEW('idlgrLight', TYPE=0, $
INTENSITY=0.8)
oTranslationModel->Add, oLight1
oTranslationModel->Add, oLight2
; Compute coordinate conversion to normalize.
;
z = data
sz = SIZE(z)
maxx = sz(1) - 1
maxy = sz(2) - 1
maxz = MAX(z,min=minz)
xs = [axesX,1.0/maxx]
ys = [axesY,1.0/maxy]
minz2 = minz - 1
maxz2 = maxz + 1
zs = [(-minz2/(maxz2-minz2))+axesZ, 1.0/(maxz2-minz2)]
; For height fields, use the following vertex colors.
;
xDimension = sz(1)
yDimension = sz(2)
vertexColors = BYTARR(3,xDimension*yDimension, /NOZERO)
shades2 = FLTARR(xDimension*yDimension)
temp = FLTARR(xDimension, yDimension)
xtot = xDimension * yDimension
temp = data
shades2(0:xtot-1) = temp(0:xDimension-1, 0:yDimension-1)
maxDataValue = 9 ; Maximum and mimimum value allowed
minDataValue = 0 ; in the data set.
maxShades = maxDataValue
minShades = minDataValue
sat = 1.0
val = 1.0
maxAngle = 225.0 ; ( angle is 0 < .. < 360 )
for j = 0, xtot-1 do begin
angle =ROUND( (shades2(j) - minShades) / $
(maxShades-minShades) * maxAngle )
Color_convert, angle, sat, val, red, green, blue, /HSV_RGB
vertexColors(0, j) = red
vertexColors(1, j) = green
vertexColors(2, j) = blue
endfor
; Create the surface.
;
oSimpleSurface = OBJ_NEW('IDLgrSurface', data, xarray, yarray, $
STYLE=2, SHADING=1, $
COLOR=[60,60,255], BOTTOM=[64,192,128], $
XCOORD_CONV=xs, YCOORD_CONV=ys, ZCOORD_CONV=zs)
oTranslationModel->Add, oSimpleSurface
; Make the surface in color.
;
oSimpleSurface->SetProperty, VERT_COLORS=vertexColors
; Rotate the original display.
;
oRotationModel->Rotate, [1,0,0], -45
oRotationModel->Rotate, [0,1,0], 45
; Place the model in the view.
;
oView->Add, oStaticModel
WIDGET_CONTROL, wDrawBase, GET_UVALUE=temp, /NO_COPY
oWindowID = temp
WIDGET_CONTROL, wDrawBase, SET_UVALUE=temp, /NO_COPY
oWindowID->Draw, oView
; Add the trackball object for interactive change
; of the scene orientation
;
oTrack = OBJ_NEW('Trackball', [xdim/2.0, ydim/2.0], xdim/2.0)
oContainer = OBJ_NEW('IDLgrContainer')
oContainer->Add, oView
oContainer->Add, oTrack
; Create the info structure.
;
sInfo = { $
center: xdim/2., $ ; Center of unit sphere
radius: ydim/2, $ ; Radius of unit sphere
pt0: FLTARR(3), $ ; Initial point of rotation
pt1: FLTARR(3), $ ; Final point of rotation
dragq: 'LOW', $ ; Drag quality(0=low, 1=med,2=high)
BtnDown: 0, $ ; mouse button down flag
OTrack: oTrack, $ ; Trackball object
OContainer: oContainer, $ ; Container object
OView: oView, $ ; View object
OStaticModel: oStaticModel, $ ; Models objects
OMovableModel: oMovableModel, $
ORotationModel: oRotationModel, $
OScalingModel: oScalingModel, $
OTranslationModel: oTranslationModel, $
OSimpleSurface: oSimpleSurface, $ ; Surface object
OWindowID: oWindowID, $
WDataTable: wDataTable, $ ; Widget table ID
WDrawBase: wDrawBase, $ ; Widget bases ID
WStyleBase: wStyleBase, $
WColorBase: wColorBase, $
WTextBase: wTextBase, $
WSliderBase: wSliderBase, $
WPopInfoBase: wPopInfoBase, $
WTableBase: wTableBase, $
WStatusBase: wStatusBase, $
WTipBase: wTipBase, $
Parent: parent, $ ; Parent of cwtable.pro
WXSlider: wXSlider, $ ; Widget sliders ID
WYSlider: wYSlider, $
WZSlider: wZSlider, $
WStatusLabel: wStatusLabel, $ ; Widget label ID
WAreaDraw: wAreaDraw, $ ; Widget draw ID
CWTextField: cWTextField, $ ; C-Widget text ID
Xdimension: xdimension, $ ; X data dimansion
Ydimension: ydimension, $ ; Y data dimension
VertexColors: VertexColors, $ ; Vertex colors array
VertexFlag: 1, $ ; Vertex olor flag
MaxDataValue: maxDataValue, $ ; Max. value of data allowed
MinDataValue: minDataValue $ ; Min. value of data allowed
}
; Put the sInfo as user value of the top level base's first child
;
child = WIDGET_INFO( wCWBASE, /CHILD)
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
XMANAGER,'cwtable', wCWBase, EVENT_HANDLER='MyTable_Event', $
/NO_BLOCK
RETURN, wCWBase
end
; -----------------------------------------------------------------------------
;
; PURPOSE : main event handler
;
pro widgets_Event, $
sEvent ; IN: event structure
; Quit the application using the close box.
;
if (TAG_NAMES(sEvent, /STRUCTURE_NAME) EQ $
'WIDGET_KILL_REQUEST') then begin
WIDGET_CONTROL, sEvent.top, /DESTROY
RETURN
endif
; Branch the event accordingly to its name and its user value.
;
eventName = WIDGET_INFO(sEvent.id, /NAME)
case eventName of
'DRAW' : begin
WIDGET_CONTROL, sEvent.top, GET_UVALUE=sState, /NO_COPY
; Expose.
;
if (sEvent.type eq 4) then begin
sState.oWindowID->Draw, sState.oView
endif
WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY
end
'BUTTON' : begin
WIDGET_CONTROL, sEvent.id, GET_UVALUE=uvalue
case uvalue of
'NEXT' : begin
WIDGET_CONTROL, sEvent.top, GET_UVALUE=sState, /NO_COPY
; If the cwtable compound widget has been destroyed
; then distroy the main base also and
; exit this application.
;
result = WIDGET_INFO(sState.wCWBase, /VALID_ID)
if (result EQ 0) then begin
WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY
WIDGET_CONTROL, sEvent.top, /DESTROY
RETURN
end
case sState.index of
; Show the base
;
0 : begin
WIDGET_CONTROL, sState.wUnLabel, $
SET_VALUE='Press NEXT to build a droplist'
WIDGET_CONTROL, sState.wTroisLabel, $
SET_VALUE='Or press QUIT to quit'
WIDGET_CONTROL, sState.wCWBase, MAP=1
sState.oModel->Add, sState.oImageArray(1)
sState.oModel->Remove, sState.oImageArray(0)
sState.oWindowID->Draw, sState.oView
end ; of 0
; Show the droplist
;
1 : begin
WIDGET_CONTROL, sState.wUnLabel, $
SET_VALUE='Press NEXT to build a list'
WIDGET_CONTROL, sState.wTroisLabel, $
SET_VALUE='Or press QUIT to quit'
child = WIDGET_INFO(sState.wCWBase, /CHILD)
WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
WIDGET_CONTROL, sInfo.wStyleBase, MAP=1
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
sState.oModel->Add, sState.oImageArray(2)
sState.oModel->Remove, sState.oImageArray(1)
sState.oWindowID->Draw, sState.oView
end ; of 1
; Show the list for color selection
;
2 : begin
WIDGET_CONTROL, sState.wUnLabel, $
SET_VALUE='Press NEXT to build a text'
WIDGET_CONTROL, sState.wTroisLabel, $
SET_VALUE='Or press QUIT to quit'
child = WIDGET_INFO(sState.wCWBase, /CHILD)
WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
WIDGET_CONTROL, sInfo.wColorBase, MAP=1
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
sState.oModel->Add, sState.oImageArray(3)
sState.oModel->Remove, sState.oImageArray(2)
sState.oWindowID->Draw, sState.oView
end ; of 2
; Show the editable text widget
;
3 : begin
WIDGET_CONTROL, sState.wUnLabel, $
SET_VALUE='Press NEXT to build sliders'
WIDGET_CONTROL, sState.wTroisLabel, $
SET_VALUE='Or press QUIT to quit'
child = WIDGET_INFO(sState.wCWBase, /CHILD)
WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
WIDGET_CONTROL, sInfo.wTextBase, MAP=1
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
sState.oModel->Add, sState.oImageArray(4)
sState.oModel->Remove, sState.oImageArray(3)
sState.oWindowID->Draw, sState.oView
end ; of 3
; Show three sliders for object rotation
;
4 : begin
WIDGET_CONTROL, sState.wUnLabel, $
SET_VALUE='Press NEXT to build a message button'
WIDGET_CONTROL, sState.wTroisLabel, $
SET_VALUE='Or press QUIT to quit'
child = WIDGET_INFO(sState.wCWBase, /CHILD)
WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
WIDGET_CONTROL, sInfo.wSliderBase, MAP=1
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
sState.oModel->Add, sState.oImageArray(5)
sState.oModel->Remove, sState.oImageArray(4)
sState.oWindowID->Draw, sState.oView
end ; of 4
; Show the table widget
;
5 : begin
WIDGET_CONTROL, sState.wUnLabel, $
SET_VALUE='Press NEXT to build a table'
WIDGET_CONTROL, sState.wTroisLabel, $
SET_VALUE='Or press QUIT to quit'
child = WIDGET_INFO(sState.wCWBase, /CHILD)
WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
WIDGET_CONTROL, sInfo.wPopInfoBase, MAP=1
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
sState.oModel->Add, sState.oImageArray(6)
sState.oModel->Remove, sState.oImageArray(5)
sState.oWindowID->Draw, sState.oView
child = WIDGET_INFO(sState.wCWBase, /CHILD)
WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
sInfo.oWindowID->Draw, sInfo.oView
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
end ; of 5
; Show the table widget
;
6 : begin
WIDGET_CONTROL, sState.wUnLabel, $
SET_VALUE='Press NEXT to build a drawing area'
WIDGET_CONTROL, sState.wTroisLabel, $
SET_VALUE='Or press QUIT to quit'
child = WIDGET_INFO(sState.wCWBase, /CHILD)
WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
WIDGET_CONTROL, sInfo.wTableBase, MAP=1
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
sState.oModel->Add, sState.oImageArray(7)
sState.oModel->Remove, sState.oImageArray(6)
sState.oWindowID->Draw, sState.oView
end ; of 6
7 : begin
WIDGET_CONTROL, sState.wUnLabel, $
SET_VALUE='Press NEXT to build a status label'
WIDGET_CONTROL, sState.wTroisLabel, $
SET_VALUE='Or press QUIT to quit'
child = WIDGET_INFO(sState.wCWBase, /CHILD)
WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
WIDGET_CONTROL, sInfo.wDrawBase, MAP=1
WIDGET_CONTROL, sInfo.wDrawBase, GET_UVALUE=temp, /NO_COPY
oDrawWindowID= temp
oDrawWindowID->Draw, sInfo.oView
WIDGET_CONTROL, sInfo.wDrawBase, SET_UVALUE=temp, /NO_COPY
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
sState.oModel->Add, sState.oImageArray(8)
sState.oModel->Remove, sState.oImageArray(7)
sState.oWindowID->Draw, sState.oView
end ; of 7
8 : begin
WIDGET_CONTROL, sState.wUnLabel, $
SET_VALUE='The aplication is now operational'
WIDGET_CONTROL, sState.wDeuxLabel, $
SET_VALUE=' '
WIDGET_CONTROL, sState.wTroisLabel, $
SET_VALUE='Or press QUIT to quit'
child = WIDGET_INFO(sState.wCWBase, /CHILD)
WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
WIDGET_CONTROL, sInfo.wStatusBase, MAP=1
WIDGET_CONTROL, sInfo.wTipBase, MAP=1
WIDGET_CONTROL, sState.wNextButton, SENSITIVE=0
WIDGET_CONTROL, sState.wSkipButton, SENSITIVE=0
sState.oWindowID->Draw, sState.oView
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
end ; of 8
endcase
sState.index = sState.index + 1
WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY
end ; of NEXT
'SKIP' : begin
WIDGET_CONTROL, sEvent.top, GET_UVALUE=sState, /NO_COPY
; If the cwtable compound widget has been destroyed
; then distroy the main base also and
; exit this application.
;
result = WIDGET_INFO(sState.wCWBase, /VALID_ID)
if (result EQ 0) then begin
WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY
WIDGET_CONTROL, sEvent.top, /DESTROY
RETURN
end
WIDGET_CONTROL, sState.wNextButton, SENSITIVE=0
WIDGET_CONTROL, sState.wSkipButton, SENSITIVE=0
WIDGET_CONTROL, sState.wUnLabel, $
SET_VALUE='The aplication is now operational'
WIDGET_CONTROL, sState.wDeuxLabel, $
SET_VALUE=' '
WIDGET_CONTROL, sState.wTroisLabel, $
SET_VALUE='Or press QUIT to quit'
sState.oModel->Remove, sState.oImageArray(sState.index)
sState.oModel->Add, sState.oImageArray(8)
; Sensitize every bases.
;
child = WIDGET_INFO(sState.wCWBase, /CHILD)
WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
waitSec = 0.3
WIDGET_CONTROL, sState.wCWBase, MAP=1
wait, waitSec
WIDGET_CONTROL, sInfo.wStyleBase, MAP=1
wait, waitSec
WIDGET_CONTROL, sInfo.wColorBase, MAP=1
wait, waitSec
WIDGET_CONTROL, sInfo.wTextBase, MAP=1
wait, waitSec
WIDGET_CONTROL, sInfo.wSliderBase, MAP=1
wait, waitSec
WIDGET_CONTROL, sInfo.wPopInfoBase, MAP=1
wait, waitSec
WIDGET_CONTROL, sInfo.wTableBase, MAP=1
wait, waitSec
WIDGET_CONTROL, sInfo.wDrawBase, MAP=1
wait, waitSec
WIDGET_CONTROL, sInfo.wStatusBase, MAP=1
wait, waitSec
WIDGET_CONTROL, sInfo.wTipBase, MAP=1
sState.oWindowID->Draw, sState.oView
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY
end ; of SKIP
'QUIT' : begin
WIDGET_CONTROL, sEvent.top, /DESTROY
end ; of QUIT
endcase
end
endcase
end
;----------------------------------------------------------------------------
;
; Purpose: Destroy the top objects and restore the previous
; color table
;
pro Widgets_Cleanup, $
wTopBase ; IN: top level base identifier
WIDGET_CONTROL, wTopBase, GET_UVALUE=sInfo, /NO_COPY
; Destroy the top objects
;
OBJ_DESTROY, sInfo.oCWView
OBJ_DESTROY, sInfo.oView
OBJ_DESTROY, sInfo.oTrack
OBJ_DESTROY, sInfo.oContainer
OBJ_DESTROY, sInfo.oImage
for i = 0, sInfo.nImage-1 do begin
OBJ_DESTROY, sInfo.oImageArray(i)
endfor
; Restore the color table
;
TVLCT, sInfo.colorTable
if widget_info(sInfo.groupBase, /valid) then $
widget_control, sInfo.groupBase, /map
end ; of widgets_Cleanup
; -----------------------------------------------------------------------------
;
; Purpose: Main driver of the compound widget cwAllwid.pro.
;
pro d_widgets, $
GROUP=group, $ ; IN: (opt) group identifier
APPTLB = appTLB ; OUT: (opt) TLB of this application
; Check the validity of the group identifier
;
ngroup = N_ELEMENTS(group)
if (ngroup NE 0) then begin
check = widget_INFO(group, /valid)
if (check NE 1) then begin
print,'Error, the group identifier is not valid'
print, 'Return to the main application'
RETURN
endif
groupBase = group
endif else groupBase = 0L
; Get the current color vectors to restore
; when this application is exited.
TVLCT, savedR, savedG, savedB, /GET
; Build color table from color vectors
;
colorTable = [[savedR],[savedG],[savedB]]
; Set up parameters
;
mapFlag = 0
xOffset = 200
yOffset = 200
; Restore the image file
;
RESTORE, filepath('wwimage.sav', $
SUBDIR=['examples','demo','demodata'])
; Create the top level base
;
if( N_ELEMENTS(group) EQ 0) then begin
wtopBase = WIDGET_BASE(TITLE='All widgets', $
/TLB_KILL_REQUEST_EVENTS, $
TLB_FRAME_ATTR=1, /COLUMN, XOFFSET=50, YOFFSET=50)
endif else begin
wtopBase = WIDGET_BASE(TITLE='All widgets', $
/TLB_KILL_REQUEST_EVENTS, $
GROUP_LEADER=group, $
TLB_FRAME_ATTR=1, /COLUMN, XOFFSET=50, YOFFSET=50)
endelse
wZeroLabel = WIDGET_LABEL(wTopBase, /ALIGN_LEFT, $
VALUE=' ' )
wUnLabel = WIDGET_LABEL(wTopBase, /ALIGN_LEFT, $
VALUE='Press NEXT to build a base and the menu bar, ')
wDeuxLabel = WIDGET_LABEL(wTopBase, /ALIGN_LEFT, $
VALUE='Press SKIP to skip all the steps, ')
wTroisLabel = WIDGET_LABEL(wTopBase, /ALIGN_LEFT,$
VALUE='Or press QUIT to exit ')
wQuatreLabel = WIDGET_LABEL(wTopBase, /ALIGN_LEFT,$
VALUE=' ')
wButtonBase = WIDGET_BASE(wTopBase, /ROW)
wSkipButton = WIDGET_BUTTON(wButtonBase, /ALIGN_RIGHT, $
VALUE='<<SKIP>>', UVALUE='SKIP')
wNextButton = WIDGET_BUTTON(wButtonBase, /ALIGN_RIGHT, $
VALUE='<<NEXT>>', UVALUE='NEXT')
wQuitButton = WIDGET_BUTTON(wButtonBase, /ALIGN_RIGHT, $
VALUE='QUIT', UVALUE='QUIT')
wImageDraw = WIDGET_Draw(wButtonBase, $
XSIZE=maxXImage, YSIZE=maxYImage, RETAIN=0, $
GRAPHICS_LEVEL=2, $
/EXPOSE_EVENTS, UVALUE='IMAGE')
wCWBase = cwtable(wTopBase, MAPFLAG=mapFlag, $
YOFFSET=yOffset, XOFFSET=xOffset)
WIDGET_CONTROL, wTopBase, /REALIZE
; Returns the top level base to the APPTLB keyword.
;
appTLB = wtopBase
oView = OBJ_NEW('idlgrview', COLOR=[255, 255, 255], $
PROJECTION=1, VIEW=[0, 0, maxXimage, maxYimage] )
oModel = OBJ_NEW('IDLgrModel')
oView->Add, oModel
nImage = 9 ; number of images
oImageArray=OBJARR(nImage)
oImageArray(0) = OBJ_NEW('idlgrimage', image0)
oImageArray(1) = OBJ_NEW('idlgrimage', image1)
oImageArray(2) = OBJ_NEW('idlgrimage', image2)
oImageArray(3) = OBJ_NEW('idlgrimage', image3)
oImageArray(4) = OBJ_NEW('idlgrimage', image4)
oImageArray(5) = OBJ_NEW('idlgrimage', image5)
oImageArray(6) = OBJ_NEW('idlgrimage', image6)
oImageArray(7) = OBJ_NEW('idlgrimage', image7)
oImageArray(8) = OBJ_NEW('idlgrimage', image8)
oImage = oImageArray(0)
oModel->Add, oImage
WIDGET_CONTROL, wImageDraw, GET_VALUE=oWindowID
oWindowID->Draw, oView
child = WIDGET_INFO( wCWBASE, /CHILD)
WIDGET_CONTROL, child, GET_UVALUE=sInfo, /NO_COPY
OCWView = sInfo.oView
OTrack = sInfo.oTrack
OContainer = sInfo.oContainer
WIDGET_CONTROL, child, SET_UVALUE=sInfo, /NO_COPY
; Create the state structure
;
sState = { $
ColorTable: colorTable, $ ; Color table to restore
WNextButton: wNextButton, $ ; Next button ID
WSkipButton: wSkipButton, $ ; Skip button ID
WQuitButton: wQuitButton, $ ; Quit button ID
OWindowID: oWindowID, $ ; Window object
OView: oView, $ ; View object
WUnLabel: wUnLabel, $ ; Widget labels IDs (un=one)
WDeuxLabel: wDeuxLabel, $ ; (deux=two)
WTroisLabel: wTroisLabel, $ ; (trois=three)
WQuatreLabel: wQuatreLabel, $ ; (quatre=four)
Index: 0, $ ; Step index (0=start , 8=last)
OCWView: oCWView, $ ; View object from compound widget
OImage: oImage, $ ; Image object
OImageArray: oImageArray, $ ; Image object array
OModel: oModel, $ ; Top model
OTrack: oTrack, $ ; Trackball object from cwtable
OContainer: oContainer, $ ; Container object from cwtable
NImage: nImage, $ ; Number of images
WCWBase: WCWBase, $ ; Top level base of the compound widget
groupBase: groupBase $ ; Base of Group Leader
}
WIDGET_CONTROL, wTopBase, SET_UVALUE=sState, /NO_COPY
XMANAGER, 'widgets', wTopBase, /NO_BLOCK, $
CLEANUP='widgets_Cleanup'
end ; of widgets